<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.5.1.js"></script>
</head>
<body>
姓名：<input type="text" name="username"><br>
年龄：<input type="number" name="age">
<button id="btn-1" type="button">注册</button>
ID：<input type="text" name="uId"><br>
<button id="btn-2" type="button">查询</button>

</form>
</body>
<script>
    $(function (){
        $("#btn-1").click(function (){
            console.log("111");
            let uname = $("input[name='username']").val();
            let uage  = $("input[name='age']").val();
            //将数据传给控制层
            $.ajax({
            url:"/tct/ar01",
           dataType:"text",
            data:{username:uname,age:uage},
            type:"post",
            success:function (resDate){
            console.log(resDate);
            }

            });
        })

                $("#btn-2").click(function (){
            console.log("111");
            let userid = $("input[name='uId']").val();

            //将数据传给控制层
            $.ajax({
            url:"/tct/ar02",

            data:{uId:userid},
            type:"get",
            success:function (resDate){
            // console.log(resDate.data);
            }

            });
        })



    });
</script>
</html>